package com.cskaoyan.controller.user;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.bo.user.AdminUserInfoBO;
import com.cskaoyan.bean.bo.user.AdminUserListBO;
import com.cskaoyan.bean.po.user.AdminUserListPO;
import com.cskaoyan.bean.vo.user.AdminUserListVO;
import com.cskaoyan.service.user.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 冯子靖
 * @Description:
 * @Date: 2022/7/18 10:42
 */
@RestController
@RequestMapping("admin/user")
public class AdminUserController {

    @Autowired
    AdminUserService adminUserService;

    @GetMapping("list")
    public BaseRespVo printAdminUserList(AdminUserListBO adminUserListBO) {
        AdminUserListVO adminUserListVO = adminUserService.selectAllAdminUser(adminUserListBO);
        return BaseRespVo.ok(adminUserListVO);
    }

    @GetMapping("detail")
    public BaseRespVo printAdminUserById(Integer id) {
        AdminUserListPO adminUserListPO = adminUserService.selectAdminUserById(id);
        return BaseRespVo.ok(adminUserListPO);
    }

    @PostMapping("update")
    public BaseRespVo updateAdminUserInfo(@RequestBody AdminUserInfoBO adminUserInfoBO) {
        Integer integer = adminUserService.updateAdminUserInfo(adminUserInfoBO);

        return BaseRespVo.ok(integer);
    }
}
